<?php
    /**
    * Handle Meeting Detail Request
    */
    if (!defined('EXPONENT')) exit('');

    if (exponent_users_isAdmin() ||  exponent_permissions_check(array("administrate","meeting","meeting_delete","meeting_assistant"),exponent_core_makeLocation("profilemodule","_syscore","")))
    {  
        $id=0;
        if (isset($_REQUEST['id']))
            $id = intval($_REQUEST['id']);

        if ($id >0)
        {
            $data=$db->selectObject('profilemodule_meeting'," id = {$id}");
            if ($data)
            {
                $meeting_language = array();
                $meeting_language["English"]="English";
                $meeting_language["Turkish"]="Turkish";
                $meeting_language["Italian"]="Italian";
                $meeting_language["Russian"]="Russian";
                $meeting_language["German"]="German";
                
                $meeting_type=array();
                $meeting_type["Phone"]="Phone";
                $meeting_type["Video"]="Video";
                $meeting_type["Face to face"]="Face to face";
                
                $data->meeting_date_text = date('m/d/Y H:i:s',$data->meeting_date);
                
                $template = new template('profilemodule','_meeting_manage_detail',$loc);
                $template->assign('meeting',$data);
                $template->assign('meeting_type',$meeting_type);
                $template->assign('meeting_language',$meeting_language);
                
                $template->register_permissions(array('administrate','configure','create','edit','delete'),$loc);
                $template->output();
                
                // history
                profilemodule::_meeting_history_add($id,"View meeting detail of {$data->user_target}", "View detail");
            }
        }
        else
        {
            exponent_http_error(404);
        }
    }
    else
        exponent_http_error(403);

?>